package com.htc.dlc;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.htc.common.ActionEvent;
import com.htc.constants.Constants;
import com.htc.controller.AboutsController;
import com.htc.controller.KidsController;
import com.htc.menu.MenuController;
import com.htc.menu.MenuController.MenuSelectedListener;
import com.htc.model.dto.KidsDTO;
import com.htc.utils.CommonActions;

public class KidsActivity extends Activity implements MenuSelectedListener {
	MenuController menuController;
	View menuView;
	View menuViewSecondary;
	LinearLayout blurimageView;
	CommonActions ca;
	TextView tv_actionbar_title;

	WebView webView_kids;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_kids);
		this.ca = new CommonActions(this);
		initViews();
		this.menuController = new MenuController(this.menuView,
				this.menuViewSecondary, this.blurimageView, this,
				getBaseContext(), KidsActivity.this);
		initData();

	}

	private void initViews() {
		tv_actionbar_title = (TextView) findViewById(R.id.tv_actionbar_title);
		tv_actionbar_title.setText("Kids section");
		this.menuView = findViewById(R.id.menu_container);
		this.menuViewSecondary = findViewById(R.id.menu_secondary);
		this.blurimageView = (LinearLayout) findViewById(R.id.lay_blur_image);
		webView_kids = (WebView) findViewById(R.id.webView_kids);

	}

	public void initData() {
		ActionEvent e = new ActionEvent(this, Constants.GET_ALL_KIDS, null,
				null);
		KidsController.getInstance().handleViewEvent(e);
	}

	public void handleControllerViewEvent(ActionEvent e) {
		KidsDTO dto = (KidsDTO) e.viewData;
		SettingsActivity st = new SettingsActivity();
		String encoding = "utf-8";
		this.webView_kids.getSettings().setJavaScriptEnabled(true);
		this.webView_kids.loadDataWithBaseURL(null, dto.getDescription(), null,
				encoding, null);
	}

	@Override
	public void onMenuSelected(int paramInt) {
		// TODO Auto-generated method stub

	}
}
